﻿#region Legal notice
/*
 * This file is part of EPPLib.
 * Copyright 2010, 2011 
 * Gianluca Esposito (info@gianlucaesposito.it)
 * ----------------------------------------------------------------------------
 * EPPLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 * 
 * EPPLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Nome-Programma; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#endregion

#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Xml.Serialization;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using EPPLib.Objects;
#endregion

namespace EPPLib.Messages
{
    [Serializable]
    [XmlRoot(ElementName = "login")]
    public class LoginMessage : BaseMessage, IMessage
    {
        #region Members
        private string _registrarID;
        private string _password;
        private string _newPassword;
        private OptionsObject _options;
        private ServicesObject _services;
        #endregion

        #region Properties
        [XmlElement(ElementName = "clID")]
        public string RegistrarID { get { return _registrarID; } set { _registrarID = value; } }
        [XmlElement(ElementName = "pw")]
        public string Password { get { return _password; } set { _password = value; } }
        [XmlElement(ElementName = "newPW")]
        public string NewPassword { get { return _newPassword; } set { _newPassword = value; } }
        [XmlElement(ElementName = "options")]
        public OptionsObject Options { get { return _options; } set { _options = value; } }
        [XmlElement(ElementName = "svcs")]
        public ServicesObject Services { get { return _services; } set { _services = value; } }

        [XmlIgnoreAttribute]
        public bool NewPasswordSpecified { get { return !string.IsNullOrEmpty(_newPassword); } }
        #endregion

        #region Constructor(s)
        public LoginMessage()
        {
            _emptyNamespace = true;
            _registrarID = string.Empty;
            _password = string.Empty;
            _newPassword = string.Empty;
            _options = new OptionsObject();
            _services = new ServicesObject();
            _services.ObjURIs.Add("urn:ietf:params:xml:ns:contact-1.0");
            _services.ObjURIs.Add("urn:ietf:params:xml:ns:domain-1.0");
            _services.ServiceExtensions.ExtensionURIs.Add("http://www.nic.it/ITNIC-EPP/extepp-1.0");
            _services.ServiceExtensions.ExtensionURIs.Add("http://www.nic.it/ITNIC-EPP/extcon-1.0");
            _services.ServiceExtensions.ExtensionURIs.Add("http://www.nic.it/ITNIC-EPP/extdom-1.0");
            _services.ServiceExtensions.ExtensionURIs.Add("urn:ietf:params:xml:ns:rgp-1.0");
        }
        #endregion
    }
}
